package com.example.swordjava;


public class Test36 {

    public static void main(String[] args) {

        int[][] a = {{1, 2, 3, 4},
                {5, 6, 7, 8},
                {9, 10, 11, 12},
                {13, 14, 15, 16}};

        System.out.println(a[0][1]);

    }

    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;

        }
    }

    /**
     * 二叉搜索树与双向链表
     * 输入一棵二叉搜索树，将该二叉搜索树转换成一个排序的双向链表
     */
    TreeNode tail = null;
    TreeNode head = null;

    public TreeNode Convert(TreeNode pRootOfTree) {
        if (pRootOfTree == null) return null;
        Convert(pRootOfTree.left);
        if (head==null){
            head = pRootOfTree;
            tail = pRootOfTree;
        }else {
            pRootOfTree.left = tail;
            tail.right = pRootOfTree;
            tail = pRootOfTree;
        }
        Convert(pRootOfTree.right);
        return head;
    }
}
